<template>
  <el-button :loading="loading" icon="refresh" @click="resetHandler"
    >重置</el-button
  >
</template>
<script>
export default {
  name: 'ResetButton',
  props: {
    loading: {
      type: Boolean,
      required: false,
      default: () => {
        return false
      },
    },
    searchForm: {
      type: Object,
      required: true,
    },
    search: {
      type: Function,
      required: true,
    },
  },
  methods: {
    resetHandler() {
      for (const key in this.searchForm) {
        delete this.searchForm[key]
      }
      this.search(1)
    },
  },
}
</script>
